Refactor for Rails 4 and v1.0.0