Added comments to the code. Added a script to run and verify the code.