first fully working version