event listeners, code improvements