Added tests, updated serialiser