Refactor app coffee loop