Added command exception handling