Complete heap functionality