add comments and fix some styling