Attempt JS optimization 1