Used Control.Monad.IfElse to replace call to ($>) with call to returning, clarifying code slightly, IMO.