Reformatted code

(too much TODOs are still to be fixed)