Replace local temps with calculations