code cleanup and added desc. for functions

Described a bit in comment for updateSideBar() the approach I took and
why