refactor arithmetics