Updated preEndState to work smoother