Altered javascript to hopefully work this time