first working version
some changes