Fix formatting and add more status checking.