refactor divide tool to be used from external tools
clean up, update script wrappers