Massive update to the code.