totally reworked image handling