Moved the main code to prog.c
Changed to int for better readability
Changed to mainLoop for readability