Adding support for 1.9

I recently (rails rumble in november) used this for our project, but it wouldn't run on 1.9, so I cleaned it up to run on 1.9 and made everything fit in a module instead of global namespace.

I haven't touched the rest of the code, so it's basically just an update to add compability with 1.9.