Cleanup and commenting of code.