Make importbedlog a separate function