refactor to remove depth from function calls
remove pointless test code
documenting private methods