swapping the arrays pointers explicitly for more compact code