do image workaround, restructure code