Tidy some code in events wrapper
Add and use functions to test variable types
Compact code for saved coords