Cleans up API code