implemented all functions, except for the async callbacks