Fixed some bugs, added VCD output and timer. This is slow.