New updated and improved code for HomeController