Changed static fail_write to lambda, cleaned up tab formatting