Removed duplicate code in the home view