Added check for whether user is logged in to determine which view to show them