added matching, clear selections, and check win javascript functions