rearranging deletion code
added some comment headers