Added comments in code to explain it better (Need to add more)