Added code for key image functionality