Fix broken eventlisten and small refactor.