refactor a class