added some comments
added checking status at end of input