generally tidied up to make more usable