Refactor with before filter