Updated to hopefully work for Rails 4