Refactored image logic into own components