eventhandler struct and rewrite of how async functions