Code cleanup, and some comments.