refactored image/icon handling