Replacing null with None, and other tidying