Some cleanup and improving sync js.