refactored main loop
Merge branch 'master' of github.com:solomonchild/course_work