Documentation and small optimizations.