few bits tidied up