Code optimizations + documentation.