Refactored to allow non-numeric treats. (Thanks, Stereo!)