Refactoring has been done to conform to MVC. Comments added for javadoc
generation later.