Added comments and removed unused code.