delete useless codes or move them to a suitable position