code clean

shaved off a KB from the js file by putting most of the code into a
single function and condensing the element hiding section of the file