Implement stdout append to file; More comprehensive states