[More refactoring and splitting up the spike code]