setMaxDuration method added