Reformat and remove useless code