Added wrapper (main) function to pi.py and some comments