The endedTimer business is a huge hack, and I don't even know if it is really needed anymore.  But I think the !playing test shouild go after clearing the endedTimer.  Actually it is probably find to put both the dragging and !playing tests after clearing the timer.

I think it would be hard to set up a test case that where something failed because of this, but it seems safer to always clear the timer before returning.