Fixed generate orb function