requiring libraries within functions