Feature/cash 150

Everything in this section except this line is the same regardless of whether there is a query or not. Refactor your code to take advantage of that.