change api, reorganize functions, add/remove some functions