Refactored to Comform MVC Pattern