reformat, use error raising, and print to STDERR

A revision for #1