update functions and add two new ones