Merged with suggestions on key generation from S Morris