updated code to work with new tofu