Refactor into objects