more code tidy ups