added login-required function