Added error flow.
Removed unused output.