side spikes, tidied up the code