TH code fixed and roundF inlined