Major code cleanup - indentations etc