switch the order of logic on if logged in