implemented two functions