Move  and  into function