Added chains as argument to kmatch.