UPDATE: continued documentation update plus function cleaning