Duration function-some changes