Made context duration a global variable