consolidate nested ifs
rename action to operation