Refactored the code for the buttons in the home controller