A bit of a tidy and made it a little more robust.