Working NAND gate simulation