final tidying - now needing testing