sort out and modify result dicts nesting structure