Move the contents of this `if` block to two different methods