Pseudocode/skeleton for trending functionality.