Modified function definitions. Removed conditional on err.