tidy scripts into a module, and add tox