removed a hardcoded iteration max count