Some cleanup and documentation