added functions to check if logged in