added comments and started to refactor application class into singleton for use in front controller.