event refactoring to use hashmap instead. fixes #26