Added some comments and removed dead code.