formatting and useless code removal