refactored with before_action