Making email and switch state detection more reliable