made value.func more general