clean up images code