refactor to plugin. don't work