migrate template to flex