Added some indents to improve readability. Added few comments