used nag example code