Added comments

organised the code.