sort of resolved the issue with the panels.js file getting called multiple times or not at all