Minor changes, code tidying