added previousState field back in