Codeformat

some automatic code format + simplify and unificate ifs and fors. Nothing changed on functional side