Better implementation of scala import function