cleaned main.cpp and made it more OOP