Cleaned up the code
Following the MVC architecture more strictly