Fixed wire type. Fixed correct result output using the internal state regs.