Refactored the HomeController