Add more tests, plus modify the way the sql execution works slightly.