refactor a bit to remove a class