changed println for the changestates and added wait statements