Extracted three methods in order to improve readability.
Merge pull request #1 from rehans/feature-1000

Extracted three methods in order to improve readability.