- refactored eventhandling