Added some more tests and an sensible to_array function