documentation updates and refactoring continued
unify api and rename deallocation function