Adding heap functionality