code is updated with 2 functions

code is updated with to functions