code optimisation and translate correction