working version without secret