Added driver tests, and fixed a bunch of small bugs