refactor to two classes