Assorted code cleanup