functions and data update