Cleaned up exception handling in plugin