Moved removal of \r into tidy()