updated binary heap code