added comments whereever necessary