refactor to class