class-based approach