Appeasing codeclimate.com

* Removing duplication of method body
* Extracting smaller methods from larger method