Move utils.delegateEvents closer to where it is used in the utils module