extracting the categorySelection.js function to its file