write error to stderr

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
refactor by pulling out closures in prep for adding a verification step

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>