cleanup and change namespace
add connection error routines