Refactor home page handler with UserLoggedIn method