Implemented more efficient version of trending()