Fixing comments by Sergei Nosov and add the check if the array is assorted