fighting infinite loops one function at a time