Implement hairpin scoring