avoid using same variable twice in the same function