How did the pencil test work?