migrated more error checking out of functions and into return conditional
Merge branch 'master' into onenotification
better handling of unexpected data