added function code for 2 funtions