Remove dead code and white space, add/move comments.