oh no, more paramters!  bugfixes too
reorder loops