move imports to top of function