More fixes on Michael's code