Added sketch of AFI code