Simplify class factory function