Rearrange the order of conditionals so that event handler doesn't
return too early