Big code cleanup and re-indented, finally ! (Thanks astyle!)