Added setTimeout/clearTimeout functionality to resize function.