Event listeners and class directive