fix: use the compare function passed in options.

feat: add a destroy function to free references.