First stab at ref support