Some refactoring in subscriptions.phtml (JavaScript code)