code copied from digger bootstrap