moved beacon event generation code into its own package and added some test cases