Moved functions around.
Starting key generation integration.