Added pi calculation logic.