Rails stuff to own file; tightening existing copy