implement optional file size optimization