FIXED BUILDING/LINKING and added template file for key management