refactor to 3 classes