No more do while

originally thought that there was an issue in writing the javascript to the main.js file but the issue lay in the fact that the file was already served but it was then written to