refactor into class