Reformat and fix a shit ton of bugs