adding client_key, cleaning code