Refactored to prevent syntax error

After four commits (one by mine) trying to fix this is better to refactor it. Here I removed the the argument outside the function call in a variable.
fix merge conflicts due to qgustavor pr and my subsequent changes
merging qgustavor update to sw.js, which is a marked improvement