Cleaned up how the query is generated & used in API.
Got delete working