cleaned up main.cpp