Assorted code tidying.