added SecureRandom, misc cleanup