Initial changes for switching from Lind to thfun