Matthews detector code