migrate templates to flex