Refactor _getComponents and executeConfigComponents

They had became ugly spaghetti code blobs.