Cleanup frame.component

by making it an array and introducing a map from componentId to index