move definition inside function