refactored class definitions