change user agent strings and add test mode
change ['agent'] to array()
move ping to the main loop
add level of debug log