Use Kryo for serialisation, since it doesn't stackoverflow on big terms.