implemented 4 API functions.