Added panic handling.