Removing unused code and redundant \n