latest ttW optimization code