refactorings and updated rails version