connection, cpid monad reader, minor sql cleanup