putting import statements back in sub-function