edited orb matching code