remove a few errant spaces
refactor createWidget function.