further work on heap, refactoring other stuff...