refactored for better event usage