Refacored and Removed reference by variable
Added comments to the script