Refactoring and recipe fixes