Enhancing the readability of the code using Extract Method

Comment From: pivotal-cla

@MaxNstk Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: snicoll

Thanks but such refactoring is subjective and we prefer to do these ourselves. As it stands the existing code looks fine.