Added some error testing code