Add tests, do some initial work on script