Minor improv: logging and error handling