refactor record