Added some diagnostic code