Implementation of heap is now basically complete. Will work through some tests in the coming days.