refactored code to make it consistent with changes made to UI controls doc.