This is good. I didn't realize you could have functions in functions in js. Doh.