first draft, working version.