improved delimiter detection