Refactor plugin: switch the status depending on conditional function instead of a flag.