Removed Bool parameter in loop in favour of Control.Monad.unless