Code restructuring for new hv