first working version with search