Implemented both functions