Refactoring code - mostly consolidating code reuse into methods