Also, there are some JSLint errors due to functions getting called before they are defined, but I wanted to make sure this is the right approach before I start changing the order of functions.