Clean up code moving some structure to dict.