cleaned up some memory issues

used scope.destroy effectively