changed line 19
added comments, fixed bug