Eliminate unnecessary variable temp2