Added some comments and removed obsolete code.