handle timeouts
refactor + unexpected exit