Added ref<>() to varheap so it can be encapsulated properly