self contained html for download
rewrote to monad State, added stats support