modified version to get control key