made heap class compatible with existing code