tidying up of code order