working version checkpoint