Tweaked to work with images properly