Minor refactoring of .js to have less hardcoded crap.