Reformat code; Large sections ported over - does not compile