Some ugly code updates