Added missing comments and cleaned up warnings.
Removed unused code.