Misc cleanup, documentation, pretty stack printing

the pretty stack printing is porbably the nicest thing here.