refactor into classes