* some refactorings (introduced ResultLookup type to remove duplicate code)
* further refactorings
* deleting from the heap marks all occurrences of an element for deletion