did a bunch more matlab->python conversion, seems to be working