move imports out of function