refactoring and select event