Completed problem for beer
Extracted a normal function
Refactored it more and extracted some common logic out