Moved some definitions to JS