Refactorings to follow rails best practices