_
Loop added for D>1 support.
Added loop to comply with D>1.
_