Don't keep local items around after deleting.
Added deletion check to various queries.