optmized for multiple files