class refactored