added javascript event delegation