refactoring to casses