implement prepare block