Refactoring, rearanged classes into an inheretance tree