Moved key generation into a helper for better testing