Correctly handles chains in DB, and deletes