refactored class structure