move logic into corresponding classes