refactor to use a stack of expression parts