Improve js widget snyppet