Much better implementation for component sets. Still work in progress.