refactor expressions and add math instances