Added various code clean up and comments.