Update and re-write ALL the code