tidied up for library