fix duplicated code
change afterInvokeApp callback implementation to simpler and robust implementation
add afterInvokeApp description on README.md