move logic into a few classes [untested - wip]