Add \r skipping code from @jespada