added comments &little improvements