moved some things around and did some debugging in digsim.js