Fix up tests, add command line utility