Fixing some runtime bugs, both correctness and performance
Adding a full circuit example