Automatic code re-format and re-organisation