Add timeout argument to recursive call