Updated translate to use an iterator instead of a vector