Improved focused event handler