Tidied up for public release