With these typos I'm surprised it works at all accoutning { ^^^^ detail unix -sql if (noop) { ok } attr_fileter.account_response ^^^^^ As Alan says . Define your logic on paper. Write a flow chart. Then implement. alan