refactor binary min heap