begins to refactor javascript
improves theme switching
cleans up more javascript