also, you should consider writing all of this in Coffeescript

since that's what we use with rails