Broke the application processes into different source files and added event handling to a
seperate file.