Clean up and document 'test_value' function.