add checking of app code
refactor popup window