first incomplete working version