removes useless code and improves format