Replaced OrderedDict with deque for epub