loop is working, need better exit from app