Introduce sinon spies, and do some cleanup