introducing af_cd() function