pi and theta now working