updated module to allow use as plugin