REMOVE: unused code
MOVED: most of the stuff from main.cpp into appropriate separate files