worked out swap method to use for in place sort