Refactor pet plugin.