added resample option if needed