updated program flow for arithmetic