changed sort methods to not perform in place