fixed translate function, TODO: plus previous ones, set state variables