Attempt JS optimization 2