updated calcuation to account for temperatures