optimised code after self testing