Make duration a local variable