Tidying up TH functions