Fixed tile matching algorithm and added localization