Code revision

Refinements + documentation