Restructured to allow plugins to pass errors back via callback