refactor with class decorator