Implemented getNewState function