finishing touches

error reporting, clean up of logic