Added comments, changed Key generation types to match.