Otu summary

Factoring some code and fixing a bug.