Some cleanup. Started break apart of main function