Various tweaks and reformatting to automap code