implemented first working version