added multiple cursor support and changed autoclose system