Removed a little repetition from the code

js:
326 sloc -> 174 sloc
11.719 kb -> 5.662 kb

min.js:
7.022 kb -> 3.065 kb