made operation sort arrays
forced sorting
added sorting flag
added sorted flag