Add well written comments.Code improvements