Final working version.