improvements to equation handling