Converted to use @login_required decorator