Merged in Jamie's STDP code