added protection to require a user to be logged in to view home page, and to prevent logged in users from visiting login or register pages