Many changes to make it work in Rails 3 and 4 and in production.