Major update of many functions