added curl init
refactor cleanup control into inputLoop
make handleEvents return an 'alive' bool
check alive bool for exit condition