refactored stuff
refactored, split up resulthandler, nexthandler, eventhandler