Working PERFECTLY in O(nlogn) for BIG n!!!