More refactoring on the image matching.
Update Rails.