a bit more granular error catching, and some delint