Huge update of the code