Make comparator function optional
Fix relative require
Add API docs