Added an if logged in clause so it doesn't hang on startup