tidying up code part III