Small improvements to looping and Complex class