Applied smart pointers to APE related classes.