Implement left factoring