Added further test cases for event handling
refactor to move rule retrieval