Performance improvement plus tidy up