complete rewrite

handles netlists, better commenting, more sensical code, and it beats
esim.m by 100 lines