Numerous bug fixes related to conversion of plugin to class