New carver script for generating Q matrices