Update Pi class and write tests for it.