updated the example code, changed some fn names