working with input/output files
multiple loops till convergence
fixed some small stuff