cleanup and smal reorgnisation