Better cursor detection