some code tidying.