refractor code using factory for breweries data