moved infix to postfix into a function