Added compareImages() function