added comments
fixed bug