minor changes to variable ordering, etc.