Modified to run with Rails 3.0