Cleaner way of detecting top level events