completed the 2 functions