Fixing some things, improving the tests