done with min heap