Unless I'm terribly wrong, ap comes as a parameter there is no need to initialize it. Or am I missing something?