analysis code. with some pretty graphs