refactor to use class-based model