Tidying up and adding tests still to be done.