Minor code cleanup. Added some comments.