switch key generation to file output - fixes #4