modified the temp conversion function