made a slight change to reset current and previous key at main activity