Added functional top k definition