Upgraded to work with new importfunction