added check to see if logged in for security