refactor .factory into .provider with better async loading settings