rearrange functions and add docs