Refactor into methods