Beginning of generate program