Some code tidying