pushed more stuff down into plugin, genericised some things