Lots of fixes. Tests are working again. Added tests for saving/loading