started with a smaller js file to find the bug