Refactored some class definitions