Add support for specifying connections, add error variable to callback