added ap.c