change dicts to defaultdicts

If a dictionary stores only one type of value (e.g. tuple), we can use defaultdict data type to speed up the code.
I've tried to find dictionaries with single type values and changed those to appropriate defaultdict types.
Let me know if there is an error.