Final working version or the Ruby implementations