Added setEndState