reused the Dictionary insertion code as well