change guard condition back to use 'If' instead of 'for'