Code for IIA and 2 very closely related papers