slight modification to variable ordering