performance enhancements, updated JSON serialiser, started adding tests