Updated matching logic, adding gem movement