Code optimisation and annotation