Code review

Documentation + optimization.