Additional functionality added to JS expander function