merging in the actual implementation of the ruby code