implementing the swap of orientation