factory provider refactored