tidied up security stuff