Possible fix for #2 by changing the order events are created
Fix for #3
Added commented code to use Device.addEvent code