implemented the 2 functions