insert my solution to the given functions