Line 256 - 270 and line 272 - 286 perform similar functionality on different config rows. Would be nice to have a common function created and shared, rather than a copy-paste.