wrote wrapper around heap, fixed keyerror bug