Optimizations and documenting