tidy up and some changes to interface