Pill sorting and auto-refills