moved module imports out of functions