add comments, fix style