refactored dict_insert implementation, uses dictionaries for writing new objects