Keygenerator to static, improved tests