added comments, and changed style