Heap: refactor in order to add more tests.