Merge pull request #10816 from bogdan/less-dirty-dirty

Make AM::Dirty less dirty to plugin into AR or other library