refactored image selection