Removed utility function logf and changed cmd functions to return an error value rather than an error code.