main classes refactored