Added some comments and general clean-up.