transfer over the rest of the spike code, now with tests