Reformat

Reformatted a lot of code, also tried new heuristics  and approach