Refactored HeapMax (a bot HeapMin also). Applied HeapMed (not implemented) data structure