Refactor of decision_test_fn