working version for my usecase: