Improved element id setting.