Added defaultdict for safety