adding listener for DOM elements