Added example on how to run the script and example of data
Refactored the code and added necessary comments