formating and removing dead code