Only register listeners when needed