Refactored and minor comments
Refactored with minor comment changes