Fleshed out details of error checks and operation.