record restructure, start of functions