Factored out API functions