Rails4 support. Refactoring.