Refactoring to Apriori