refactored by extracting component, container, and image logic into their own modules