log connection errors
First pass at the API / cleanup