Pulling the `begin..end` into it's own method might make this method somewhat clearer.