Added main.cpp and fixed a myriad of compiler errors