100 Line Goal, So Close

This code needs tested, but it brings the code closer to the goal of 100 lines, by being only 102 lines. Additionally, it includes fixes suggested by JSLint.