added code for computing translation.