isdigit is better than is_int
Clean up some code with defaultdict