older validation replaced by State-monad based validation