Towards n * log(n) jajascript complexity!