Abstracting the clearTimeout function