Update the function according to the new API.
Work on the test and overall work on the API.