rewrite after lots of comments