Refactoring code to use neurons and synapses