removed unnecessary totalBytes counter