added some exception handling...