Made it a lot better, more javascript-y.