WIP: added docs and cleaned up function names