refactor decorator order guard code into helper