Add first version of topn function and tests