adding back some stuff I accidentally deleted while debugging 9b05d88321204369027dff33ebd1451db42a4394