moved event delegation to DOM