update question1
change using couter to slice
move render part out