Implement all the four functions.