Refactor into class