Changed Dstate to int