First mostly working version.