tided up & sudo coded in what is still to be done