implementing AP sample