Rearrange some code to work properly from a new appliance