modified: ap func