update main.cpp. removed bugs in steps 1 & 2.

remaining weird shit code, see comments bitch