Added method to set cursor state