There is a lot of ugliness in this code…