Thoroughly commented the code