added the license headers and logic to return single value when a single value is requested, but the result is a list