Add integration tests for the DELETE API. A little code cleanup.