Added $timeout as parameter

Removed $timeout as new variable and added as parameter