Reverting to Ruby implementation