complete API (still with runtime error)