Tidied up error conditions and unclean break points (return out of plugin if action is unnecessary)