allow user to omit the error callback, remove some globals