More Refactoring, about to add to rails app