Separate out the business logic from the stuff that depends on it

It's good to have one file that is only business logic.