Added error handling
Improving tests
Implemented array serialization and implemented nicer reference store