minor security refactoring