Switched a JS and simplified