working version.