Cleaned up thread template