Pattern Template Machine