Use a compare function
Clean up
Merge pull request #8 from PreetamJinka/issues/7-compare-func

Switch to a compare function