integrated the algorithm into a rails app