Added some code to check status