Added check for login