update WordState and adding math functions