refactor pill eating