Refactoring to support loading component factories via service loader
Removed redundant typecast