Add ability to generate secret keys from makefile. Misc cleanup.