refactoring into more classes