Error-checking, logging, and additions