added counterAppsFromR
pass APP_NAME explicitly