Added getAip function
It still produces a segmentation fault*