migrate to class-based code