added secret_key logic