version 1.1 with new adjacent_swap method