Major update of code