Implemented a factory method for Component creation.