Some improvements to the general structure.