 * added array sorting functions;
 * indexes modified to check array uniqueness.